Skip to content

Instantly share code, notes, and snippets.

@ninodafonte
ninodafonte / LayerMask.cs
Created July 5, 2024 15:43 — forked from unitycoder/LayerMask.cs
LayerMask set initial value to "Default" or "Everything" or multiple layers
public LayerMask layerMask = 1 << 0; // default layer (0)
public LayerMask layerMask2 = ~0; // everything
public LayerMask layerMask2b = -1; // everything
public LayerMask layerMask3 = default;// nothing
public LayerMask layerMask4 = 0;// nothing
public LayerMask layerMask4b; // nothing
public LayerMask layerMask5 = 1 << 5;// layer 5 (UI)
public LayerMask layerMask6 = 1 << 2 | 1 << 5;// Ignore Raycast (Layer 2) AND UI (Layer 5)
public LayerMask layerMask7 = ~(1 << 4 | 1 << 5); // all except layer 4 and 5
public LayerMask layerMask8 = ~(1 << 4); // all except layer 4

Keybase proof

I hereby claim:

  • I am ninodafonte on github.
  • I am ninodafonte (https://keybase.io/ninodafonte) on keybase.
  • I have a public key ASC3FiQWyozR8UIUptAYlKhdPZuCfyxJmrP_Qs994jWuowo

To claim this, I am signing this object:

@ninodafonte
ninodafonte / python restore dump
Last active April 20, 2018 10:34
Restore dump python
https://stackoverflow.com/questions/12124959/import-sql-dump-with-subprocess
with open(dump_filename, 'r') as f:
command = ['mysql', '-u%s' % db_settings['USER'], '-p%s' % db_settings['PASSWORD'], db_settings['NAME']]
proc = subprocess.Popen(command, stdin = f)
stdout, stderr = proc.communicate()
Also check https://codepoets.co.uk/2010/python-script-to-backup-mysql-databases-on-debian/ for dumps
mongoimport --db tweetsProcessed --collection placemarksCAS2017 --jsonArray --file agile_users_geo_cas2017.json
@ninodafonte
ninodafonte / somefile.py
Last active October 30, 2017 06:42
Read Json file and insert into Mongodb #mongo #python
with open('agile_users_geo.json') as data_file:
data = json.load(data_file)
for item in data['data']:
key = {"id": item['features']['id']}
data = {"geo_type": item['features']['geo_type'],
"location": item['features']['location'],
"name": item['features']['name'],
"primary_geo": item['features']['primary_geo'],
"screen_name": item['features']['screen_name'],
"tweets": item['features']['tweets']}
@ninodafonte
ninodafonte / gist:11398116
Last active August 17, 2017 13:46
Change git:// by https:// default in Git clone #git
git config --global url."https://".insteadOf git://
git config --global --unset url."https://".insteadOf
@ninodafonte
ninodafonte / gist:7302811
Last active August 17, 2017 13:47
Remove mergeinfo #svn
svn propdel svn:mergeinfo -R
svn revert .
svn ci -m "Removed mergeinfo"
@ninodafonte
ninodafonte / customAutoIncrement.sql
Last active August 17, 2017 13:48
Create autoincrement with a specific number (date) #postgres
set @autoincrementValue = (SELECT DATE_FORMAT(NOW(), '%y%m%d') * 10000);
SET @s = CONCAT("alter table NameOfYourTable auto_increment=", @autoincrementValue);
PREPARE stmt FROM @s;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
svn info http://{SVN.REPOSITORY}/tags/{TAG_NAME} | grep 'Last Changed Rev'
@ninodafonte
ninodafonte / tailAllFiles.sh
Last active August 17, 2017 13:49
Tail all log files #linux #logs
find -type f | xargs tail -f