Skip to content

Instantly share code, notes, and snippets.

View VladRez's full-sized avatar

Vladislav Reznikov VladRez

  • Nisum
  • San Francisco
View GitHub Profile
@VladRez
VladRez / git-bash-notes.md
Last active September 8, 2018 02:16
Notes on using Git

Clone Bare Repo

Clone all branches in a repository at once. Add extra .git to clone without main directory.

git clone --bare https://gitgub.com/user/repo.git .git

Convert to regular github project

git config -- bool core.bare false
@VladRez
VladRez / powershell-media-duration.ps1
Created April 16, 2019 21:30
Display video/audio length in powershell
$Folder = 'C:\path\to\media\';
$sec = 0
$min = 0
$hr = 0
$len = @()
Get-ChildItem -Recurse | ForEach-Object {
$File = $_.Name;
@VladRez
VladRez / cpp-linked-list.cpp
Created April 16, 2019 21:59
C++ linked list with pointers
#include <iostream>
struct CD {
int trackNumber;
CD * nextSong;
CD(int selection, CD * track) {
trackNumber = selection;
nextSong = track;
}
};
@VladRez
VladRez / extended-gcd.cpp
Created April 16, 2019 22:09
extended euclidean algorithm
#include <stdio.h>
int egcd(int a, int b, int *x, int *y) {
if (a == 0) {
*x = 0;
*y = 1;
return b;
}
@VladRez
VladRez / nyc-links-cams-curl.c
Last active April 16, 2019 22:22
Display first 100 nyc-links data formatted.
@VladRez
VladRez / name-decoration.cpp
Created April 16, 2019 22:19
Displays internal function name decoration/mangling
#include<iostream>
using namespace std;
extern "C" void examplefunction(double arg1);
int main(void) {
examplefunction(100);
}
void examplefunction(double arg1) {
@VladRez
VladRez / github-no-configured-push-destination.sh
Created April 20, 2019 22:31
No configured push destination
# fatal: No configured push destination
# # Remote #local:#remote branch
git push --set-upstream https://github.com/username/repo.git master:master
# use `--force` flag on conflict
import urllib.request
url = 'https://www.somewebsite.com/somefile'
req = urllib.request.Request(url, method='HEAD')
res = urllib.request.urlopen(req)
filename = res.info().get_filename()
urllib.request.urlretreve(url, f"/target/dir/{filename}")
pattern description
(?=subexp) look-ahead
(?!subexp) negative look-ahead
(?<=subexp) look-behind
(?
#!/bin/bash
curl -u "$1" https://api.github.com/user/repos -d "{\"name\":\"$2\"}"
git init
git remote add origin "https://github.com/$1/$2.git"
touch README.md
echo 'cli-push-remote-repo.sh' >> .gitignore
echo '.gitignore' >> .gitignore