Skip to content

Instantly share code, notes, and snippets.

View vladak's full-sized avatar

Vladimir Kotal vladak

  • Europe
View GitHub Profile
@vladak
vladak / sync.md
Created February 20, 2017 15:21
sync with upstream

from @DaveRandom:

  • Add another remote to your local clone: git remote add upstream https://github.com/OpenGrok/OpenGrok (this will also work with [email protected]:OpenGrok/OpenGrok.git if you prefer to work over SSH)
  • Fetch information about the new remote you just added to allow you to work with it locally: git fetch upstream
  • Sync your local changes with the upstream remote: git pull --rebase upstream master. After doing this you may need to resolve conflicts, git will instruct you on what it expects you to do. By the looks of if you shouldn't currently have any issues with this.
  • "Squash" your commits into a single commit: git rebase -i HEAD~14. This will start an interactive rebase, it will launch a text editor to enable you to complete it, more info here.
  • Once you have done this you will need to perform a forced push (git push -f) to the master branch of your origin remote to update this pull request.

I HIGHLY RECOMMEND that you practice this by creating a new local branch based on your c

@vladak
vladak / curl.md
Created February 20, 2017 18:21 — forked from btoone/curl.md
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@vladak
vladak / gist:87de4f58c89f8ba61027c646e50c6f86
Created September 20, 2017 19:11
git and shell prompt
https://github.com/jimeh/git-aware-prompt
https://www.youtube.com/watch?v=g8BRcB9NLp4
https://github.com/banga/powerline-shell#bash
https://www.quora.com/What-is-the-best-Bash-prompt-for-Git
https://github.com/Bash-it/bash-it
https://github.com/Lokaltog/vim-powerline
https://github.com/lucascosti/bashrc
git command/branch completion
https://github.com/magicmonty/bash-git-prompt
@vladak
vladak / gist:a69956dd6afc982deb66c3594cce86d4
Last active October 31, 2017 20:41
Tagging unix-prog-in-c
Use numbered tags, starting with v0
Optionally, append a description, e.g. v10-translated-foo
Create and push a tag like so:
git tag vXYZ
git push origin tagXYZ
It is recommended to push concrete tag to avoid pushing lightweight/local tags.
- finish the sleep -> join (thread num in argv[1]) task
- write a simple program that creates couple of threads, each doing a number arithm ops
- after random number of the ops, the thread SIGSEGV's, observe the result
- compile with debug flags, see if gdb can display stacks of all threads at the moment of crash
- write simple program with 2 thread types - one sleeping in syscall, another looping and printing to stdout
- create more than 1 thread of each type
- the threads doing syscals can e.g. pick a random file from /etc directory, open it and read it
- each thread will write its own thread ID to stdout once running
- goal: see if the other threads run while another sleeps in syscall
- see if truss/strace can display thread IDs
- signals and threads (*go through the slide first*):
- create process with N threads
- see if sending a signal to the whole process with multiple threads will deliver the signal to
different threads (perform various activities in the threads - I/O, CPU intensive, mix of both, ...)
- define a foo_t type as structure with a reference count and implement 2 macros:
FOO_REHOLD - bumps the refcount
FOO_REFRELE - decrement the refcount and if 0, call foo_free()
that will de-initialize the data structure
- implement negative unit test
tasks:
- rewrite queue-simulation.c to use RW locks
- add another thread that will print the number of items
in the queue less frequently than the main thread
- run atomic-add in multiple modes, compare the results
- write pthread_barrier impl
- start with phtread_barrier_t, pthread_barrier_wait()
- rewrite semaphores/posix-sem-fixed-race.c to use unnamed
semaphores. Are they kernel persistent ?
foo
+--------+
| |
+--------+
- notable features/changes in 1.1:
- RESTful API
- Python scripts
- indexer parallelization
- Suggester (Adam Hornacek's master thesis)
- new highlighter
- LOC column
- no packages anymore
- Search CLI EOF
- project centric approach
- mysh: go through detailed task description
- can start coding right away (parsing), do not have to wait until fork()/pipe()/exec() are explained
- the shell cannot (and should not) be coded in couple of days
- write your own unit tests
- demonstrate how to use Github+Travis
.travis.yml:
language: c
compiler:
- clang