Skip to content

Instantly share code, notes, and snippets.

View Sy1v4in's full-sized avatar

Sylvain Fraïssé Sy1v4in

  • @ Sunday
  • Montpellier, France
View GitHub Profile
cat >> /etc/sudoers.d/aoadmin-as-anyone << 'EOF'
aoadmin ALL=(ALL) NOPASSWD: ALL
EOF
#!/usr/bin/env bash
sudo apt-get -y install zsh git-core
curl -L http://install.ohmyz.sh | sh
sudo chsh -s `which zsh`
cat >> ~/.zshrc << 'EOF'
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
#!/usr/bin/env bash
wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get --yes update
sudo apt-get --yes install jenkins default-jdk
#!/usr/bin/env bash
#Execute as root or sudo
cd /opt
wget http://dl.google.com/android/android-sdk_r23.0.2-linux.tgz
tar zxvf android-sdk_r23.0.2-linux.tgz
chown -R root /opt/android-sdk-linux
chmod -R 755 /opt/android-sdk-linux
rm android-sdk_r23.0.2-linux.tgz
#!/bin/bash
stash() {
# check if we have uncommited changes to stash
git status --porcelain | grep "^." >/dev/null;
if [ $? -eq 0 ]
then
if git stash save -u "git-update on `date`";
then
[user]
name = <name>
email = <email>
[color]
# Enable colors in color-supporting terminals
ui = auto
[alias]
st = status
ci = commit
co = checkout
@Sy1v4in
Sy1v4in / good-diffJson.js
Created January 28, 2020 18:05
Piece of code showing how to use diffJson. Could be used to redefine a better tap extension…
import * as Diff from 'diff'
import colors from 'colors/safe'
const diff = Diff.diffJson(postedData, expectedConversationManagerModel)
diff.forEach(part => {
const color = part.added ? 'green' : part.removed ? 'red' : 'grey'
process.stderr.write(colors[color](part.value))
})
console.log()
@Sy1v4in
Sy1v4in / synchronize-staging.mjs
Created June 1, 2023 10:41
A simple script using zx that synchronizes the staging branch with the main one and merging the PR labelized win in-staging
#!/usr/bin/env zx
import 'zx/globals'
import { Octokit } from '@octokit/rest'
const octokit = new Octokit({
auth: process.env.GH_TOKEN,
})
const currentBranch = async () => $`git branch --show-current`