Skip to content

Instantly share code, notes, and snippets.

@RoamCoder
RoamCoder / New Snippet
Last active May 5, 2024 05:47
New Snippet
pub
// Optional (Not enum like options) : Ther are 4 ways to solve possible nil / value issue, as following.
// Especially needed when declaring an empty array, but not sure if expanded later on.
fds
var ages: [Int] = [21, 45, 18, 71, 44, 23, 17] /* value */
// var ages: [Int] = [] /*nil*/
ages.sort()
// if let : if something is an existed and assignable value, or non-existed and unassignable nil.
@0xjac
0xjac / private_fork.md
Last active May 5, 2024 05:44
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@OrionReed
OrionReed / dom3d.js
Last active May 5, 2024 05:42
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@palewire
palewire / README.md
Last active May 5, 2024 05:41
How to push tagged Docker releases to Google Artifact Registry with a GitHub Action

How to push tagged Docker releases to Google Artifact Registry with a GitHub Action

Here's how I configured a GitHub Action so that a new version issued by GitHub's release interface will build a Dockerfile, tag it with the version number and upload it to Google Artifact Registry.

Before you attempt the steps below, you need the following:

  • A GitHub repository that contains a working Dockerfile
  • The Google Cloud SDK tool gcloud installed and authenticated

Create a Workload Identity Federation

@bradtraversy
bradtraversy / js_linked_list.js
Last active May 5, 2024 05:37
JS Linked List Class
// Construct Single Node
class Node {
constructor(data, next = null) {
this.data = data;
this.next = next;
}
}
// Create/Get/Remove Nodes From Linked List
class LinkedList {
@Drallas
Drallas / High Available Pi-hole failover cluster using Keepalived and Orbital Sync.md
Last active May 5, 2024 05:36
High Available Pi-hole failover cluster using Keepalived and Orbital Sync
@mlafeldt
mlafeldt / elf.h
Last active May 5, 2024 05:35
elf.h for OSX
/* This is the original elf.h file from the GNU C Library; I only removed
the inclusion of feature.h and added definitions of __BEGIN_DECLS and
__END_DECLS as documented in
https://cmd.inp.nsk.su/old/cmd2/manuals/gnudocs/gnudocs/libtool/libtool_36.html
On macOS, simply copy the file to /usr/local/include/.
Mathias Lafeldt <mathias.lafeldt@gmail.com> */
/* This file defines standard ELF types, structures, and macros.
@chrisidakwo
chrisidakwo / nigerian-states.json
Last active May 5, 2024 05:33
All 36 states in Nigeria, and their local government areas - including the Federal Capital Territory and its area councils
{
"Abia": [
"Aba North",
"Aba South",
"Arochukwu",
"Bende",
"Ikwuano",
"Isiala-Ngwa North",
"Isiala-Ngwa South",
"Isuikwato",
@sebastiandero
sebastiandero / 1v1.cfg
Created March 8, 2017 15:24
1v1 config for CSGO
bot_kick;
exec gamemode_competitive;
mp_free_armor 1;
mp_freezetime 3;
mp_weapons_allow_map_placed 1;
mp_humanteam any;
mp_restartgame 1;
mp_round_restart_delay 3;
mp_roundtime 80250;
mp_maxrounds 30;
@dvddarias
dvddarias / Arrows2DMovement.cs
Last active May 5, 2024 05:32
Unity editor script to precisely move, rotate and scale GameObjects on a 2D scene, using the arrow keys.
/*
Unity editor script to precisely move, rotate and scale GameObjects on 2D scenes, using the arrow keys.
Notes:
- To use it just include it on an "Assets/Editor" folder on your project.
- The action depends on the selected tool and the size of the movement depends on the Scene view zoom.
- The more "zoomed in" is the scene view the smaller is the movement step.
- It will work when the current Scene tab is in 2D mode and there is at least one gameObject selected,
otherwise the scene camera will move as usual :)