Skip to content

Instantly share code, notes, and snippets.

View VjeraTurk's full-sized avatar
💭
São Miguel

Vjera Turk VjeraTurk

💭
São Miguel
View GitHub Profile
@dlew
dlew / script.sh
Created November 9, 2018 16:36
Simple AndroidX Migration Script
#!/usr/bin/env bash
# I've found that the "Migrate to AndroidX" converter in Android Studio doesn't work very
# well, so I wrote my own script to do the simple job of converting package names.
#
# You can download a CSV of package names here: https://developer.android.com/topic/libraries/support-library/downloads/androidx-class-mapping.csv
#
# It'll run faster on a clean build because then there are fewer files to scan over.
#
# Uses `gsed` because I'm on a Mac. Can easily replace with `sed` if you don't have `gsed`.
@ryesalvador
ryesalvador / tamagotchi.py
Last active January 22, 2024 10:35
Tamagotchi Emulator in PyGame
# Tamagotchi - A port of the Tamagotchi Emulator by aerospark: https://goo.gl/gaZ1fA
# Copyright (C) 2017 Ryan Salvador
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@bsamartins
bsamartins / httpcache.service.ts
Last active December 8, 2022 09:29
Angular Universal Caching Service
@Injectable()
export class HttpCacheService {
constructor(public _http: Http,
public _cache: CacheService,
@Inject("isNode") public isNode:boolean,
@Inject("isBrowser") public isBrowser:boolean) { }
get<T>(url, options?: RequestOptionsArgs, autoClear: boolean = true, browserCaching:boolean = false): Observable<T> {
@yjaaidi
yjaaidi / prerender-clean-up.js
Last active February 1, 2022 17:01 — forked from imevro/gist:edfe9dea12196056467f
Clean up all cached pages in prerender.io from console
const cleanUp = async () => {
const response = await fetch('https://prerender.io/api/cached-pages?page=0&pageSize=100');
const itemList = await response.json();
const csrfToken = document.cookie.replace(/^.*XSRF-TOKEN=/, '').replace(/;.*$/, '');
const promiseList = itemList.map(item => fetch(`https://prerender.io/api/remove-cached-url?url=${encodeURIComponent(item.url)}`, {
method: 'DELETE',
headers: {
@calippo
calippo / eblow.py
Last active November 11, 2019 13:21
[scikit-learn/sklearn, pandas] Plot percent of variance explained for KMeans (Elbow Method)
import pandas as pd
import matplotlib.pyplot as plt
import seaborn
from sklearn.cluster import KMeans
import numpy as np
from scipy.spatial.distance import cdist, pdist
def elbow(df, n):
kMeansVar = [KMeans(n_clusters=k).fit(df.values) for k in range(1, n)]
centroids = [X.cluster_centers_ for X in kMeansVar]
/*
Reddit DailyProgrammer Challenge #180 -- Tamagotchi Emulator
By Aerospark12 (aka Luke)
I may have gone a little bit overboard with this one, but I've got fond memories of tamagotchi from when
I was but a wee laddie, I've always wanted to make something like this, and I really enjoy graphics and animation
The design of this is partially inspirte by how I understand "low level" ICs to work, as an homage to the real tamagotchi
@adamjohnson
adamjohnson / publickey-git-error.markdown
Last active April 18, 2024 01:00
Fix "Permission denied (publickey)" error when pushing with Git

"Help, I keep getting a 'Permission Denied (publickey)' error when I push!"

This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:

  1. Open git bash (Use the Windows search. To find it, type "git bash") or the Mac Terminal. Pro Tip: You can use any *nix based command prompt (but not the default Windows Command Prompt!)
  2. Type cd ~/.ssh. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\ on Windows)
  3. Within the .ssh folder, there should be these two files: id_rsa and id_rsa.pub. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa and id_rsa.pub in order for Git, GitHub, and BitBucket to recognize them by default.
  4. To create the SSH keys, type ssh-keygen -t rsa -C "your_email@example.com". Th
@Mithrandir0x
Mithrandir0x / disable_wifi_hotspot.bat
Last active August 20, 2018 09:30
Two little batch files to create a cozy WiFi hotspot from the laptop Snatched from xda-developers, yet I don't remember the thread. Kudos to the author.
netsh wlan stop hostednetwork
pause
@kogakure
kogakure / .gitignore
Last active December 17, 2023 08:21
Git: .gitignore file for LaTeX projects
*.acn
*.acr
*.alg
*.aux
*.bak
*.bbl
*.bcf
*.blg
*.brf
*.bst