Skip to content

Instantly share code, notes, and snippets.

View steelx's full-sized avatar
🎮
GameDev by night

Ajinkya Borade steelx

🎮
GameDev by night
View GitHub Profile
@kennetpostigo
kennetpostigo / Migrating.md
Last active June 2, 2021 17:44
How I migrated from ReactRouter v2 to v4

First couple things I thought about when migrating after reading the docs

So migrating my existing app wasn't as troublesome as I originally thought. First thing I did was take a look at my router and routes and figure try to make a mental model of all the files where I had nested routes in the existing app because those components/containers will contain {this.props.children}. So I need to replace those with the nested <Match /> components.

So just to give an example:

In v2:

<Router history={history}>
  <Route path="/" component={App}>

#Headless Setup of Raspberry Pi Zero W (Raspberry Pi 3 Wireless) (macOS)

  1. Formatt the Micro SD card - Open a terminal and type 'diskutil list'. Find your card and copy the disk name (For example: /dev/disk4). Format the card with diskutil eraseDisk ExFat temp disk4(Use your disk here)
  2. Download Raspbian - wget https://downloads.raspberrypi.org/raspbian_lite_latest
  3. Unmount the SD card - diskutil unmountDisk /dev/disk4 or whatever your disk path is
  4. Mount the Raspbian image to the card - sudo dd if=PATH-TO-RASPBIAN-IMAGE of=/dev/disk4` or whatever your disk path is
  5. Enable SSH on the Pi - cd /volumes && ls. You should see a boot partition from the SD card cd boot && touch ssh
  6. Setup WiFi on the PI - While still in the boot partition of the card type nano wpa_supplicant.conf and enter network={ ssid="YOUR-SSID" psk="YOUR-WIFI-PASSWORD" }
  7. Boot the PI - Unmount the card diskutil unmountDisk /dev/disk4 (or whatever your disk path is) and put it in the
@ebraminio
ebraminio / upload.go
Last active March 22, 2023 06:01
golang upload client and server
// curl -X POST -H "Content-Type: application/octet-stream" --data-binary '@filename' http://127.0.0.1:5050/upload
package main
import (
"fmt"
"io"
"net/http"
"os"
"time"
# Run with elevated privileges
# If you have Connect Wise Control installed, remove it. IT organizations are likely to install it (or similar tool) if they feel the need for Netskope clients.
# RE: https://saputra.org/threads/remove-screenconnect-or-connectwise-control-from-windows-mac-linux.45/
function remove_cswincom() {
thumbprint=$(ls /Library/LaunchAgents/connectwisecontrol-* | head -1 | awk -F- '{print $2}')
# Stop the ConnectWiseControl Client service
launchctl unload /Library/LaunchAgents/connectwisecontrol-${thumbprint}-onlogin.plist
# Delete the service definitions
rm -f /Library/LaunchAgents/connectwisecontrol-${thumbprint}-*.plist
@esfand
esfand / angular-jqlite.adoc
Last active April 19, 2023 01:32
Angular jqLite

Angular jqLite

jQuery and Angular

Angular doesn’t depend on jQuery. In fact, the Angular source contains an embedded lightweight alternative: jqLite. Still, when Angular detects the presence of a jQuery version in your page, it uses that full jQuery implementation in lieu of jqLite. One direct way in which this manifests itself is with Angular’s element abstraction. For example, in a directive you get access to the element that the directive applies to:

@cjus
cjus / sample-nginx.conf
Last active July 12, 2023 14:59
AngularJS Nginx and html5Mode
server {
server_name yoursite.com;
root /usr/share/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
alert('hello ' + document.location.href);
@irfn
irfn / alacrity.yml
Last active August 31, 2023 14:36
alacrity config
env:
TERM: xterm-256color
window:
dimensions:
columns: 80
lines: 24
padding:
x: 2
@cowboy
cowboy / #bf4-emblem-import-export.md
Last active December 3, 2023 17:43
JavaScript: BF4 Battlelog Emblem Import / Export

Exporting an emblem

  1. Log into BF4 Battlelog.
  2. Visit the Customize emblem page.
  3. Select the emblem you wish to export.
  4. Open the console (Ctrl-Shift-J).
  5. Enter the following code snippet to copy the raw emblem data to the clipboard:
    copy('emblem.emblem.load('+JSON.stringify(emblem.emblem.data,null,2)+');');
  6. Paste somewhere useful, like a gist. Whatever.
  7. Close the console (Ctrl-Shift-J).
@mauricedb
mauricedb / Subject under test
Last active December 7, 2023 14:46
Testing stateful React hooks
import { useState } from 'react';
export function useCounter(initial = 0) {
const [count, setCount] = useState(initial);
return [count, () => setCount(count + 1)];
}