Skip to content

Instantly share code, notes, and snippets.

View marc0x71's full-sized avatar

Marco Bollero marc0x71

  • Italy
  • 22:23 (UTC -12:00)
View GitHub Profile
@marc0x71
marc0x71 / Fask grep -vf
Last active November 9, 2020 08:33
Fast grep -vf
awk 'FNR==NR {hash[$0]; next} !($0 in hash)' file-piccolo file-grande
@marc0x71
marc0x71 / extract-a-predetermined-range-of-lines-from-a-text-file.bash
Created October 9, 2018 14:29
Extract a predetermined range of lines from a text file
sed -n 100,200p filename
@marc0x71
marc0x71 / find_by_ids.js
Created September 23, 2018 21:12
Mongoose - Find by IDs
Reports.find( { _id: { $in : ids_array } }, (err, found) => {});
@marc0x71
marc0x71 / Test.java
Created December 4, 2017 14:37
RxJava / concat
List<Observable<String>> list = new ArrayList<>();
list.add(Observable.just("one", "two"));
list.add(Observable.just("three", "four", "five"));
list.add(Observable.just("six", "seven", "eight"));
list.add(Observable.just("nine", "ten"));
Observable.concat(list).subscribe(new Consumer<String>() {
@Override
public void accept(String s) throws Exception {
@marc0x71
marc0x71 / AppInjector.java
Created November 17, 2017 14:19
Dagger2 - AppInjector
/*
In the App
*/
public class GithubApp extends Application implements HasActivityInjector {
@Inject
DispatchingAndroidInjector<Activity> dispatchingAndroidInjector;
@Override
@marc0x71
marc0x71 / AndroidManifest.xml
Created November 2, 2017 15:07
Child activity
<activity
android:name=".DetailActivity"
android:parentActivityName=".MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>
@marc0x71
marc0x71 / App.java
Created November 1, 2017 19:21
Default Timber app
public class MyApp extends Application {
@Override
public void onCreate() {
super.onCreate();
if (BuildConfig.DEBUG) {
Timber.plant(new Timber.DebugTree() {
@Override
protected String createStackElementTag(StackTraceElement element) {
@marc0x71
marc0x71 / load_gtfs.cql
Last active April 28, 2021 16:42
Load GTFS data into Neo4j
//LOAD CSV script for GFTS data
create constraint on (a:Agency) assert a.id is unique;
create constraint on (r:Route) assert r.id is unique;
create constraint on (t:Trip) assert t.id is unique;
create index on :Trip(service_id);
create constraint on (s:Stop) assert s.id is unique;
create index on :Stoptime(stop_sequence);
create index on :Stop(name);
//add the agency
@marc0x71
marc0x71 / MainActivity.java
Created June 7, 2016 16:41
VectorDrawable on pre-lollipop
public class MainActivity extends AppCompatActivity {
static {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
...
}
@marc0x71
marc0x71 / values.txt
Created June 6, 2016 10:38
Android screen size values
-- TABLET --
values-sw720dp 10.1” tablet 1280x800 mdpi
values-sw600dp 7.0” tablet 1024x600 mdpi
-- PHONE --
values-sw480dp 5.4” 480x854 mdpi
values-sw480dp 5.1” 480x800 mdpi
values-xhdpi 4.7” 1280x720 xhdpi
values-xhdpi 4.65” 720x1280 xhdpi
values-hdpi 4.0” 480x800 hdpi