Skip to content

Instantly share code, notes, and snippets.

🔭

Gilad Peleg pgilad

🔭
Block or report user

Report or block pgilad

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yoavweiss
yoavweiss / Remap_esc_key.sh
Created Oct 7, 2018
Remap § to Esc and Esc to F24
View Remap_esc_key.sh
#!/bin/bash
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000029}, {"HIDKeyboardModifierMappingSrc":0x700000029,"HIDKeyboardModifierMappingDst":0x700000073}]}'
@pgilad
pgilad / Dockerfile
Last active Nov 26, 2019
Minimal Spring Boot 2 on Docker Alpine with Java 11 (Using Jigsaw modules)
View Dockerfile
FROM alpine:3.8 AS builder
WORKDIR /opt
ARG JDK_TAR=openjdk-11+28_linux-x64-musl_bin.tar.gz
ARG JDK_DOWNLOAD_PREFIX=https://download.java.net/java/early_access/alpine/28/binaries
RUN wget -q "$JDK_DOWNLOAD_PREFIX/$JDK_TAR" && \
wget -q "$JDK_DOWNLOAD_PREFIX/$JDK_TAR.sha256"
RUN cat $JDK_TAR.sha256 | xargs -I{} echo "{} $JDK_TAR" | sha256sum -c - && \
@lopugit
lopugit / gist:21f5b55e0eb656c1d4dccccf89ec8310
Last active Oct 20, 2019
Setting the Mac hostname or computer name from the terminal
View gist:21f5b55e0eb656c1d4dccccf89ec8310
Summary
This article provides instructions on setting the hostname of a Mac OS X workstation from the terminal.
This can be useful when configuring your workstation remotely through ssh, or when you need to change the fully qualified hostname of the workstation (which can't be done from the UI).
Note: The following procedure is for informational purposes only and is not an Autodesk certified or supported workflow. Should issues arise with this procedure, they will not be addressed by Autodesk Customer Support.
Procedure
Perform the following tasks to change the workstation hostname using the scutil command.
Open a terminal.
@pgilad
pgilad / main.go
Created Aug 8, 2018
Generate stable random name from string (used to generate docker tag from git branch)
View main.go
package main
import (
"fmt"
"hash/fnv"
"math/rand"
"os"
"github.com/docker/docker/pkg/namesgenerator"
)
View How we use cloudfront and next.js.md

How we incorporate next and cloudfront (2018-04-21)

Feel free to contact me at robert.balicki@gmail.com or tweet at me @statisticsftw

This is a rough outline of how we utilize next.js and S3/Cloudfront. Hope it helps!

It assumes some knowledge of AWS.

Goals

View docker-compose.yaml
version: '2.1'
services:
grafana:
container_name: grafana
image: proxx/grafana-armv7
user: "1000"
ports:
- 3000:3000
volumes:
- /opt/grafana:/etc/grafana:rw
@pgilad
pgilad / Instructions.md
Last active Nov 18, 2019
Generate SSL Certificate for use with Webpack Dev Server (OSX)
View Instructions.md

Generate private key

$ openssl genrsa -out private.key 4096

Generate a Certificate Signing Request

openssl req -new -sha256 \
@ggarcia24
ggarcia24 / pipeline.gdsl
Last active Nov 23, 2019
GDSL supporting pipeline declarative
View pipeline.gdsl
//The global script scope
def ctx = context(scope: scriptScope())
//What things can be on the script scope
contributor(ctx) {
method(name: 'pipeline', type: 'Object', params: [body: Closure])
property(name: 'params', type: 'org.jenkinsci.plugins.workflow.cps.ParamsVariable')
property(name: 'env', type: 'org.jenkinsci.plugins.workflow.cps.EnvActionImpl.Binder')
property(name: 'currentBuild', type: 'org.jenkinsci.plugins.workflow.cps.RunWrapperBinder')
property(name: 'scm', type: 'org.jenkinsci.plugins.workflow.multibranch.SCMVar')
@pgilad
pgilad / word_count.hs
Created Dec 16, 2017
Dictionary word count in Haskell
View word_count.hs
import Data.List
import qualified Data.Map.Strict as Map
import Data.Ord (comparing)
wordFrequency :: (Ord a) => [a] -> Map.Map a Int
wordFrequency xs = foldr (\word acc -> Map.insertWith (+) word 1 acc) Map.empty xs
nBiggest :: Int -> Map.Map a Int -> [(a, Int)]
nBiggest n m = take n $ sortBy (comparing $ negate . snd) $ Map.toList m
@mort3za
mort3za / git-auto-sign-commits.sh
Last active Dec 9, 2019
Auto sign your git commits
View git-auto-sign-commits.sh
# Generate a new pgp key: (better to use gpg2 instead of gpg in all below commands)
gpg --gen-key
# maybe you need some random work in your OS to generate a key. so run this command: `find ./* /home/username -type d | xargs grep some_random_string > /dev/null`
# check current keys:
gpg --list-secret-keys --keyid-format LONG
# See your gpg public key:
gpg --armor --export YOUR_KEY_ID
# YOUR_KEY_ID is the hash in front of `sec` in previous command. (for example sec 4096R/234FAA343232333 => key id is: 234FAA343232333)
You can’t perform that action at this time.