Skip to content

Instantly share code, notes, and snippets.

@Tristor
Tristor / iptables.sh
Last active May 6, 2021
Simple IPtables script for an OpenVPN server
View iptables.sh
#!/bin/bash
# Flushing all rules
iptables -F FORWARD
iptables -F INPUT
iptables -F OUTPUT
iptables -X
# Setting default filter policy
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
@escapedcat
escapedcat / README.md
Last active Feb 12, 2021
Tutorial: Cordova iOS build with fastlane, match and Jenkins
View README.md

Cordova CI with Jenkins for iOS apps

Inspired by CI server on Mac OS for iOS using GitLab and Fastlane by @v_shevchyk we decided to write down our approach. This will be extended and improved over time.

So you want to deploy your Cordova app, but you hate opening xcode manually to archive and export and sign and cry? Try this. By this we mean we try to explain how to create the following CI (Jenkins) setup:

  • Build Cordova app
  • Create & sign your ipa file
  • Upload to HockeyApp (for Enterprise distribution)
View 0.README-Linux-Command-Line-Cheat-Sheet.md

A collection of Linux commands and concepts I tend to forget

@GavinJoyce
GavinJoyce / gist:4f81d0bf879dad6b203e
Last active Nov 20, 2020
speeding up `npm install` by disabling the progress bar
View gist:4f81d0bf879dad6b203e
with `react-native`:
npm set progress=false && rm -rf ~/.npm && rm -rf node_modules && npm cache clean && time npm install
npm install 83.72s user 26.03s system 100% cpu 1:49.32 total
npm set progress=true && rm -rf ~/.npm && rm -rf node_modules && npm cache clean && time npm install
npm install 199.30s user 27.32s system 91% cpu 4:08.29 total
--
@ttscoff
ttscoff / dontforget.bash
Last active May 26, 2021
Quick reminders from Terminal (bash)
View dontforget.bash
#!/bin/bash
# dontforget
#
# A stupid script for short term reminders in bash
#
# Arguments just need to contain a number and a bunch of words.
#
# The number can be anywhere in the arguments, but there shouldn't
# be any other numeric digits.
#
@pixelhandler
pixelhandler / ember-cli-upgrade-1.13.8-to-1.13.13.sh
Last active Dec 6, 2015
Bash script to update dependencies (based on release notes) for an ember-cli app or addon, v1.13.8 -> v1.13.13
View ember-cli-upgrade-1.13.8-to-1.13.13.sh
#!/usr/bin/env bash
# Use with arg $1 as --app or --addon and optional arg $2 as --backup to keep a copy of the original files
#
# Upgrade Ember-CLI dependencies from 1.13.8 to 1.13.13
#
# - https://github.com/twokul/ember-cli-release-notes/commit/1cee41eb91bf7c534917fdd4cd42a1cd1a481c75
# - https://github.com/ember-cli/ember-cli/releases/tag/v1.13.12
# - https://github.com/ember-cli/ember-cli/releases/tag/v1.13.13
@robmiller
robmiller / archive-github.rb
Created Oct 27, 2015
Clones a GitHub repository locally, and then deletes it from GitHub. Useful for cleaning up no-longer-needed private repos. Usage: archive-github OWNER REPO_NAME
View archive-github.rb
#!/usr/bin/env ruby
#
# archive-github
#
# Author: Rob Miller <r@robm.me.uk>
#
# Clones a GitHub repository locally, and then deletes it from GitHub.
# Useful for cleaning up no-longer-needed private repos.
#
# Assumes you have an OAuth token stored in an environment variable
@searls
searls / gloan.sh
Last active Aug 20, 2018
Clone into a new repo and quickly switch into it. Helps avoid a haphazard collection of unorganized github repos all over my home directory. Once it's cloned (or even if it errors), just hit Paste & it'll change into the directory of the repo.
View gloan.sh
#!/bin/sh -e
# A simple script to keep a tidy ~/code directory organized by owner & then repo
# When the script is done, just hit command-v to switch into the directory
# (Github and Mac only. Sorry, openness!)
#
# Usage:
# gloan <org>/<repo>
# Or:
# gloan <org> <repo>
@searls
searls / duplicate-retro-rasterized-keynote-slides.scpt
Created Oct 20, 2015
Will export the top-level keynote document to one-image-per-build, then downsize to 640x480, then upscale back to 1024x768, then create a new keynote document of one slide per image. Yes, really.
View duplicate-retro-rasterized-keynote-slides.scpt
tell application "Keynote"
activate
if playing is true then tell the front document to stop
if not (exists document 1) then error number -128
display dialog "This script will export the front presentation as images and then create a new presentation containing the exported images." & return & return & "Slide transitions and presenter notes will be transfered from the source presentation." with icon 1
-- STORE INFORMATION ABOUT FRONT DOCUMENT
tell front document
@steveklabnik
steveklabnik / summary.md
Created Sep 29, 2015
my summary of "using Rust with Ruby: a deep dive with Yehuda Katz"
View summary.md

My summary of https://www.youtube.com/watch?v=IqrwPVtSHZI

TL;DR:

Rails has a library, ActiveSupport, which adds methods to Ruby core classes. One of those methods is String#blank?, which returns a boolean (sometimes I miss this convention in Rust, the ?) if the whole string is whitespace or not. It looks like this: https://github.com/rails/rails/blob/b3eac823006eb6a346f88793aabef28a6d4f928c/activesupport/lib/active_support/core_ext/object/blank.rb#L99-L117

It's pretty slow. So Discourse (which you may know from {users,internals}.rust-lang.org) uses the fast_blank gem, which provides this method via a C implementation instead. It looks like this: https://github.com/SamSaffron/fast_blank/blob/master/ext/fast_blank/fast_blank.c

For fun, Yehuda tried to re-write fast_blank in Rust. Which looks like this: