Skip to content

Instantly share code, notes, and snippets.

View sirtawast's full-sized avatar

Sampo Tawast sirtawast

  • Motley Agency
  • Helsinki, Finland
View GitHub Profile
@sirtawast
sirtawast / MouseAllYouWantIn3D.cs
Last active June 1, 2016 07:11
Cursor point raycasting in Unity3D
// Invert mouse y-axis and reduce taskbar height
Vector2 mousePos = Event.current.mousePosition;
mousePos.y = Screen.height - 35 - mousePos.y;
// Raycast
Ray ray = Camera.current.ScreenPointToRay(mousePos);
@sirtawast
sirtawast / gist:34678d285f083e3fcb14
Last active August 29, 2015 14:20
Simple AJAX form for MailChimp list subscriptions
<form id="mc-form" action="#" class="">
<div id="mc-input-container">
<input name="EMAIL" class="" type="email" placeholder="Your email" required>
<input id="mc-form-submit" class="mc-input-submit" type="submit" value="Submit">
</div>
<div style="display: none;" id="mc-form-success" class="">
Success! To finish your subscription go to your inbox and confirmation the confirmation message sent to you.
</div>
<div style="display: none;" id="mc-form-error" class="">
Error!
@sirtawast
sirtawast / dump.sh
Last active June 13, 2016 11:14
Backup PostgreSQL or MySQL
# Back up SQL
# ===========
# dump_db.sh (chmod 0700)
# Format in any preferable way, see:
# http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/
# %a is weekday Mon-Sun, %H is hour 00-24
timestamp() {
date +"%a_%H"
@sirtawast
sirtawast / rename
Last active December 22, 2021 00:50
Rename all file extensions recursively on Mac OSX command line
find . -type f -iname "*.ext1" -exec bash -c 'mv "$0" "${0%}.ext2"' {} \;
@sirtawast
sirtawast / 0_reuse_code.js
Created April 19, 2017 08:58
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@sirtawast
sirtawast / GP7-mac-crash-report
Created August 14, 2017 07:11
GP7 crashes on play when using Bluetooth headphones
Process: GuitarPro7 [16932]
Path: /Applications/Guitar Pro 7.app/Contents/MacOS/GuitarPro7
Identifier: com.arobas-music.guitarpro7
Version: 7.0.5.699 (7.0.5.699)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: GuitarPro7 [16932]
User ID: 501
Date/Time: 2017-08-14 10:06:16.919 +0300

Keybase proof

I hereby claim:

  • I am sampohaavisto on github.
  • I am sampohaavisto (https://keybase.io/sampohaavisto) on keybase.
  • I have a public key ASAxQEWFweob4LuwNB2LNf853kbGeIbSGkZr_cb2QU--AQo

To claim this, I am signing this object:

@sirtawast
sirtawast / restore-and-copy-files-from-s3-glacier.sh
Last active May 15, 2024 09:48
AWS: Restore and change S3 storage class
#!/bin/bash
# (should not be run as shell script, the steps take so long)
# Restore/change AWS S3 files from Glacier storage class to STANDARD or STANDARD_IA and copy them in-place to get non-expiring ones
# There wasn't any instructions on how to do this easily so I decided to write them.
# In case you screw things up with lifecycle options etc.
# Procedure might take a while if you have many many files.
# There are three steps:

Keybase proof

I hereby claim:

  • I am sirtawast on github.
  • I am sampohaavisto (https://keybase.io/sampohaavisto) on keybase.
  • I have a public key ASAxQEWFweob4LuwNB2LNf853kbGeIbSGkZr_cb2QU--AQo

To claim this, I am signing this object:

@sirtawast
sirtawast / .bash_functions
Last active September 11, 2018 13:01
bash_profile and functions
repeat() {
echo Repeating \"$1\" for every $2 sec
while true
do
eval $1
if [ -n $2 ]; then
sleep $2
else
sleep 5