Skip to content

Instantly share code, notes, and snippets.

View dimkir's full-sized avatar
🎯
Focusing

dimkir

🎯
Focusing
View GitHub Profile
@yyogo
yyogo / spliterr.sh
Last active January 23, 2024 10:37
Split stderr from comand to separate tmux pane
#!/bin/bash
set -m
showhelp() {
echo "Usage: $0 [-ohvrc] <command>"
echo "Pipes stderr from command to a new tmux pane."
echo " -h | -v split horizontally or vertically (default vertically)"
echo " -r send stdout to pane instead of stderr"
echo " -o send both stdout and stderr to new panes"
echo " -c close pane automatically after program terminates"
@kevindice
kevindice / react-app-s3-sync.sh
Created January 27, 2019 02:19
A shell script for uploading a React app build to S3 + CloudFront for deployment
#!/bin/bash
S3_BUCKET_NAME=$1
CF_ID=$2
# Sync all files except for service-worker and index
echo "Uploading files to $S3_BUCKET_NAME..."
aws s3 sync build s3://$S3_BUCKET_NAME/ \
--acl public-read \
--exclude service-worker.js \
function getCognitoCreds() {
console.log("starting function getCognitoCreds");
var cognitoUser = cognitoFactory.getCognitoUser();
cognitoUser.getSession(function(err, session) {
if (err) {
console.log(err, err.stack);
console.log("error getting the session");
} else {
if (session.isValid() === false) {
console.log("session is not valid");
[core]
excludesfile = ~/.gitignore_global
pager = diff-so-fancy | less --tabs=4 -RFX
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[alias]
aa = add --all
@sintaxi
sintaxi / regions.txt
Last active March 28, 2022 02:12
Surge Regions
List of regions your project is served from when you deploy using surge.
yyz.surge.sh : 159.203.50.177 : CA : Toronto
jfk.surge.sh : 159.203.159.100 : US : New York
sfo.surge.sh : 138.197.235.123 : US : San Francisco
lhr.surge.sh : 46.101.67.123 : GB : London
ams.surge.sh : 188.166.132.94 : NL : Amsterdam
fra.surge.sh : 138.68.112.220 : DE : Frankfurt
sgp.surge.sh : 139.59.195.30 : SG : Singapore
@tdukart
tdukart / kebabCase.js
Last active February 2, 2020 05:53
JavaScript Kebab Case function
/**
* Given a string, converts it to kebab case (lowercase, hyphen-separated). For example,
* "makeFoo" becomes "make-foo", and "a Multi Word string" becomes "a-multi-word-string".
*
* @param {string} string Your input string.
* @returns {string} Kebab-cased string.
*/
function kebabCase(string) {
var result = string;
@merlinvn
merlinvn / gulp.js
Created September 18, 2016 08:46
Gulp for C++
var gulp = require('gulp');
var exec = require('child_process').exec;
var cmakeCommand = "mkdir -p build; cd build; cmake ..;";
var cleanCommand = "rm -rf build";
var testCommand = "cd build; ctest -V";
//"cmake --build ."
@bastman
bastman / aws-cli-cognito-get-open-id-token-for-developer-identity.md
Last active May 2, 2021 15:43
aws cognito examples (bash / php): custom auth provider

Aws Cognito: Custom Auth (Developer Authenticated Identities)

How to get OpenID Token & IdentityId from AWS Cognito?

  • example: using bash (aws cli sdk)
  • example: using php (aws php sdk v3.*)

note

  • you need to add example.com as custom auth provider in aws console (cognito/federated)
@lashex
lashex / aws-iot-mosquitto
Created May 23, 2016 21:05
Example Mosquitto CLI pub/sub using AWS IoT MQTT endpoint
The Mosquitto Pub CLI
$> mosquitto_pub --cert thing-0.pem --key thing-0.prv --cafile aws-iot-rootCA.crt -h XXXXXXXXYYYYY.iot.us-west-2.amazonaws.com -p 8883 -t 'test/thing' -m "Hello from Mosquitto"
The Mosquitto Sub CLI
$ mosquitto_sub --cert thing-0.pem --key thing-0.prv --cafile aws-iot-rootCA.crt -h XXXXXXXXYYYYY.iot.us-west-2.amazonaws.com -p 8883 -t 'test/+'
@sintaxi
sintaxi / hosting-an-event-on-surge.md
Last active December 8, 2017 17:29
Instructions for hosting an event on surge.sh

Hosting a competition on surge.sh

...by adding an EVENT.json file to the root of your project.

Hosting an event on surge is very simple. It's three easy steps.

  1. Publish a project to Surge to your root domain (eg. surge ./myproject superevent.io)
  2. Point superevent.io and *.superevent.io DNS records to surges servers.
  3. Add EVENT.json file with the following properties...